<template>
	<view>
	    <view class="searchdv">
	        <view class="searchdvaaa">
	            <input type="text" class="inppd" 
	             v-model="keywords" placeholder="请输入经销商名称"   />
	            <view class="searchbt" @click="click_search" >查询</view>
	        </view>
	        <view class="navlist">
	            <view class="nadtitle"> 经销商信息</view>
	            <view class="liava" v-for="item in datalist"  @click="choose_item(item)" >
	                <view class="litems">
	                    <text> 经销商编号：</text>
	                    <text>{{item.user_code}}</text>
	                </view>
	                <view class="litems">
	                    <text>经销商名称：</text>
	                    <text>{{item.username}}</text>
	                </view>
	                <view class="litems">
						<view class="itemna" v-if="item.role == 1">经销商类型：省代</view>
						<view class="itemna" v-if="item.role == 2">经销商类型：经销商</view>
						<view class="itemna" v-if="item.role == 3">经销商类型：分销商</view>
						<view class="itemna" v-if="item.role == 4">经销商类型：门店</view>
	                </view>
	            </view>
	        </view>
	        <view class="nodata" v-if="datalist.length == 0">暂无经销商数据</view>
	    </view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				keywords:"",
				shop_code:"",
				datalist:[]
			}
		},
		onLoad() {
			this.get_wd_data()
		},
		methods: {
			choose_item(item){
				console.log(item)
				uni.navigateTo({
					url:"/pages/main/duojifahuo/fahuo/fahuo?wd="+item.user_code+"&wdname="+item.username
				})
			},
			click_search(){
				this.get_wd_data()
			},
			get_wd_data(){
				var that=this
				var postdata={}
				postdata.keywords=this.keywords
				postdata.user_id=uni.getStorageSync("fahuo_username").id
				this.request('/api/duoqudao/wdstore_list', postdata,"post").then(data => {
					that.datalist=data.data
				})
			},
		}
	}
</script>

<style>
.inppd{
  height: 40px;
  line-height: 40px;
  border:  1px solid #eee;
  font-size: 14px;
  border-radius: 20px 0px 0px 20px;
  padding-left: 10px;
  background-color: #fff;
  width: calc(100% - 40px);
}
.nodata{
  background-color: #fff;
  text-align: center;
  padding: 40px 0px;
  font-size: 14px;
  color: #999;
}
.searchdv{
  width: 90%;
  margin: 0px auto;
}
.searchdvaaa{
  display: flex;
  margin-top: 24px;
  height: 40px;
  line-height: 40px;
}
.searchbt{
  width: 80px;
  text-align: center;
  background: #fff;
  border-radius: 0px 40px 40px 0px;
  margin-top: 1px;
  height: 40px;
}
.navlist{
  margin-top: 10px;
}
.liava{
  width:calc(100% - 20px);
  margin: 10px auto;
  font-size: 14px;
  border-bottom: 1px solid #eee;
  background: #fff;
  padding: 10px;
  border-radius: 5px;
}
.searchdva{

}
page{
  background-color: #eee;
}
.nadtitle{
  height: 35px;
  line-height: 35px;
  border: 1px solid #eee;
  padding-left: 10px;
  border-radius: 5px;
  background: #fff;
}
.litems{
  line-height: 27px;
}
.litems text:nth-child(1){
  font-size: 14px;
}
.litems text:nth-child(2){
  font-size: 14px;
}
</style>
